package com.lenovo.agricultureServer.bean;

import java.util.ArrayList;

public class Controller extends Component 
{
	public static final String WATER_PUMP_CONTORL 	= "WaterPump";	//水泵控制器
	public static final String BLOWER_CONTORL 		= "Blower";		//风扇控制器
	public static final String ROADLAMP_CONTORL 	= "Roadlamp";	//路灯控制器
	public static final String BUZZER_CONTORL 		= "Buzzer";		//蜂鸣器控制器
	
	private int status = 0; //控制器的打开状态，默认为关闭, 0表示关闭，1表示打开

	public Controller(String name, int subDev) {
		super(name, subDev);
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public static Controller getControllerByName(ArrayList<Controller> crlList, String name)
	{
		Controller ret = null;
		if(crlList!=null && name!=null)
		{
			for(Controller crl : crlList)
			{
				if(name.equals(crl.getName()))
				{
					ret = crl;
					break;
				}
			}
		}
		return ret;
	}
}
